<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/home/include/init_home.jsp" %>
<%@ page import="com.welfare.home.*" %>
<%
	HashBox box = new HashBox(request);	


	
	/* 파라미터 */
	//검색종류 k:키워드, s:간편검색, d:상세검색, p:프로그램검색, m:모바일
	String ty					= "m";
	
	
	/* 키워드검색 */
	String keyword_col			= StringUtil.nvl(request.getParameter("keyword_col"), "service_name");
	String keyword				= StringUtil.nvl(request.getParameter("keyword"));
	
	
	
	
	HashMap infos = new HashMap();
	infos.put("ty",				ty);
	
	if ("service_name".equals(keyword_col)) {
		infos.put("keyword_col",	keyword_col);
		infos.put("service_name",	keyword);
		infos.put("order_col", 		"hit_count desc, service_id desc");
	} else {
		infos.put("keyword_col",	"");
		infos.put("keyword",		keyword);
		infos.put("order_col", 		"srt, hit_count desc, service_id desc");
	}
	
	infos.put("paging_size", "5");
	infos.put("line_per_page", "10");
	infos.put("curr_page", StringUtil.nvl(request.getParameter("curr_page"), "1"));

	HomeDAO dao 	= new HomeDAO();
	
	HashList list 	= dao.selectServiceList(infos);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
	<title>복지자원검색</title>
	<link rel="stylesheet" type="text/css" href="./css/m_main.css" />
	<script type="text/javascript">
	function fnSearch(currPage) {
		document.kForm.curr_page.value = currPage;
		document.kForm.submit();
	}
	</script>

</head>
<body>
    <div id="header">
        <!-- 검색어 입력영역 시작 -->
        <div>
            <h2 class="title01"><a href="./msearch.jsp"><img src="./images/mobile/title02_m.gif" alt="맞춤복지 검색 서비스" /></a></h2>
            <div class="serch01">            
                <form name="kForm" method="get" action="./search.do">
	                <input type="hidden" name="ty" value="<%=ty %>"/>
	                <input type="hidden" name="curr_page" value=""/>
	                <fieldset>
	                   <legend>맞춤복지 검색 폼 </legend>
		                <div class="serch02">
			                <input class="textbar01" type="text" name="keyword" value="<%= keyword %>" title="검색어 입력"></input>
			                <input class="serchButton01" type="image"  src="./images/mobile/btn_search_m.jpg" alt="검색" />
		                </div>
	                </fieldset>
	                <div  class="search_radio">
		                <input type="radio" name="keyword_col" id="keyword_col1" value="service_name" <%= StringUtil.checked("service_name", keyword_col) %>/><label for="keyword_col1">서비스명</label>
		                &nbsp;&nbsp;
		                <input type="radio" name="keyword_col" id="keyword_col2" value="all" <%= StringUtil.checked("all", keyword_col) %>/><label for="keyword_col2">서비스명+내용</label>
	                </div>
                </form>
            </div>
        </div>
        <!-- 검색어 입력영역 종료 -->
        <!-- 검색결과 리스트 시작 -->
        <div class="serchList01">
            <ul>
        <%	for (int i = 0; i < list.size(); i++) { %>
                <li><a href="./mservice.jsp?service_id=<%= list.get("service_id", i) %>" target="_blank"><%= list.get("service_name", i) %></a></li>
        <%	} %>           
            </ul>
            
            <% 	if (list.size() == 0) { %>
            <!-- 검색결과 없음 시작 -->
            <div id="nodata">
            	<p>입력하신 조건에 일치하는 검색결과가 없습니다.</p>
            </div>
            <!-- 검색결과 없음 종료 -->
            <%	} %>
            
            
            <% 	if (list.size() > 0) { %>
            <!-- 페이징 시작 -->
            <div class="pagination">
                <%= StringUtil.getPageHtml(infos) %>
            </div>
            <!-- 페이징 종료 -->
            <% } %>
        </div>
        <!-- 검색결과 리스트 종료 -->
        <!-- footer 시작 -->
	    <div id="footer">
	        <ul>
	            <li><a href="#header"><img src="images/mobile/m_btn_top.gif" alt="맨위로" /></a></li>
	            <li><a href="http://bokji.sdm.go.kr/search.jsp"><img src="images/mobile/m_btn_pc.gif" alt="pc버전 바로가기" /></a></li>
	        </ul>
	   		<address>2014 Copyright 서대문구청 All Rights Reserved</address>
	   </div>
	    <!-- footer 끝 -->
    </div>

</body>
</html>
